package com.lzw.security.controller;

import com.lzw.security.entity.*;
import com.lzw.security.exception.MysqlUpdateException;
import com.lzw.security.exception.TidcNulException;
import com.lzw.security.ov.UserOV;
import com.lzw.security.service.DeleteService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：冯涛滔
 * @date ：Created in 2020-3-28 22:29
 * @description：删除请求控制器
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/delete")
public class DeleteController {
    @Autowired
    private DeleteService deleteService;
    /**
     * create by: 冯涛滔
     * description: 删除一个分类
     * create time: 2020-3-29 13:28
     * @params [category] id
     * @return com.lzw.security.ov.UserOV<java.lang.Integer>
     */
    @ApiOperation("删除一个类别 必填id")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/category")
    public UserOV<Integer> deleteCategory(@RequestBody Category category) throws MysqlUpdateException, TidcNulException {

        return deleteService.deleteCategory(category);
    }
    /**
     * create by: 冯涛滔
     * description: 删除一个商品
     * create time: 2020-3-29 13:28
     * @params [id]
     * @return com.lzw.security.ov.UserOV<java.lang.Integer>
     */
    @ApiOperation("删除一个商品 必填id")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/commodity")
    public UserOV<Integer> deleteCommodity(@RequestBody Commodity commodity) throws TidcNulException {
        return deleteService.deleteCommodity(commodity);
    }
    @ApiOperation("删除一个秒杀商品 必填id")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/seckill")
    public UserOV<Integer> deleteSectill(@RequestBody Seckill seckill){
        return deleteService.deleteSectill(seckill);
    }
    @ApiOperation("删除一个配料 必填id")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/dosing")
    public UserOV<Integer> deleteDosing(@RequestBody Dosing dosing) {
        return deleteService.deleteDosing(dosing);
    }
    @ApiOperation("删除一个商品连接的附属品 就是那两个长长的字段要填")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/commodity/accessory")
    public UserOV<Integer> deleteCommodityAccessory(@RequestBody CommodityAccessory commodityAccessory) {
        return deleteService.deleteCommodityAccessory(commodityAccessory);
    }
    @ApiOperation("删除一个附属品连接的配料 就是那两个长长的字段要填  ")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/accessory/dosing")
    public UserOV<Integer> deleteAccessoryDosing(@RequestBody AccessoryDosing accessoryDosing) {
        return deleteService.deleteAccessoryDosing(accessoryDosing);
    }
//    @ApiOperation("删除一个商品的配料 必填id")
//    @CheckId
//    @CheckUpdate
//    @DeleteMapping("/dosing/commodity")
//    public UserOV<Integer> deleteDosingInCommodity(DosingCommodity dosingCommodity) {
//        return deleteService.deleteDosingInCommodity(dosingCommodity);
//    }
    @ApiOperation("删除一个附属品 必填id")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/accessory")
    public UserOV<Integer> deleteAccessory(@RequestBody Accessory Accessory){
        return deleteService.deleteAccessory(Accessory);
    }
    @ApiOperation("删除一个购物车 必填id")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/cart")
    public UserOV<Integer> deleteCart(@RequestBody Cart cart){
        return deleteService.deleteCart(cart);
    }
    @ApiOperation("删除一个优惠卷")
    @CheckId
    @CheckUpdate
    @DeleteMapping("/coupon")
    public UserOV<Integer> deleteCoupon(@RequestBody Coupon coupon){
        return deleteService.deleteCoupon(coupon);
    }
}
